#!/usr/bin/env python

import random

def gen(fin_path: str, fout_path: str, num: int=32):

    fin = open(fin_path, "r").readlines()
    fin = [ line.strip() for line in fin ]
    result = random.sample(fin, num)
    result.sort()
    fout = open(fout_path, "w")
    for item in result:
        print(item, file=fout)
    fout.close()

if __name__ == "__main__":
    gen("person_train.txt", "train.txt", 48)
    gen("person_trainval.txt", "trainval.txt", 16)
    gen("person_val.txt", "val.txt", 16)
